<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>todo list</title>
  </head>
  <body>
    <script src="https://unpkg.com/vue@next"></script>

    <div id="root"></div>

    <script>
      Vue.createApp({
        data() {
          return {
            list:[],
            inputValue:""
          };
        },
        methods:{
            hanleAddItem(){
                this.list.push(this.inputValue);
                this.inputValue = "";
            }
        },
        template: `
                   <ul>
                        <input type="text" v-model="inputValue">
                        <button v-on:click="hanleAddItem">增加</button>
                        <li v-for="(item,index) of list">{{item}} ---{{index}}</li>
                    <ul>
                  
               `,
      }).mount("#root");
    </script>
  </body>
</html>
